#ifndef BIGINTEGER_H
#define BIGINTEGER_H

#include <string>
#include <iostream>

class BigInteger {
private:
    std::string num;
    bool isNegative;

    // 去除前导零
    void removeLeadingZeros();
    // 比较两个正数的大小，返回 1（a>b）、0（a==b）、-1（a<b）
    int compareAbs(const BigInteger& other) const;

public:
    // 构造函数
    BigInteger();
    BigInteger(const std::string& str);
    BigInteger(long long val);

    // 运算符重载
    BigInteger operator+(const BigInteger& other) const;
    BigInteger operator-(const BigInteger& other) const;
    BigInteger operator*(const BigInteger& other) const;
    BigInteger operator/(const BigInteger& other) const;

    // 友元函数，用于输入输出
    friend std::ostream& operator<<(std::ostream& os, const BigInteger& bigInt);
    friend std::istream& operator>>(std::istream& is, BigInteger& bigInt);
};

#endif // BIGINTEGER_H

